<?php

class blog extends CI_Model
{

    public $members;

    /**
     * Constructor
     */
    function __construct ()
    {
       
    }
//======Neary==== add post================
    function add_post($title,$content){
        $post_data = array(
                'title' => $title,
                'body' => $content,
                'author' =>null,
                'image_name' =>null
        );
        $this->db->set('date', 'NOW()', FALSE);
        $this->db->insert("message", $post_data);
    }
 //======Neary =====get post================
    function get_post(){
        //$query = $this->db->get('message');
        $query = $this->db->query("select * from message");
        return $query->result();
    }
    
    
    
    
    function get_members ()
    {
        $query = $this->db->get('members');
        return $query->result();
    }
    
    function add_members ($fname, $lname, $age,$gender,$email,$user,$pass)
    { 

        $data = array(
               'firstname' => $fname,
                'lastname' => $lname,
                'age' => $age,
                'gender' => $gender,
                'email' => $email,
                'username' => $user,
                "password" => $pass
                 
        );
        $this->db->insert("members", $data);       
    }
    function delete_this_user($user){ 
    }
}

class Member
{

    /**
     *
     * @var name
     */
    public $name;

    /**
     *
     * @var password
     */
    public $password;

    /**
     *
     * @var male or female
     */
    public $gender;

    function __construct ($name, $password, $gender)
    {
        $this->name = $name;
        $this->password = $password;
        $this->gender = $gender;
    }
}